﻿#ifndef QIMAGE_LABEL_H_
#define QIMAGE_LABEL_H_

#include <QWidget>
#include "JZImageGraphic.h"

class JZImageLabel : public QWidget
{
    Q_OBJECT

public:
    JZImageLabel(QWidget *parent = nullptr);
    ~JZImageLabel();

    QImage image();
    void setImage(QImage image);

    void setGraphics(const QList<JZGraphic> &graphList);
    const QList<JZGraphic> &graphics();
    void addGraphics(JZGraphic g);
    void clearGraphic();

    virtual QSize sizeHint() const override;

protected:
    virtual void paintEvent(QPaintEvent *event) override;    
    void updatePixmap();

    QImage m_image;
    QPixmap m_pixmap;
    QList<JZGraphic> m_graphList;
};


#endif // !QIMAGE_LABEL_H_
